# -*- coding: utf-8 -*-
"""
-------------------------------------------------
Project Name: luffcity study project
File Name: Event练习.py
Author: kij
Create Date: 2021/3/19
-------------------------------------------------
"""
# 启动事件 通知另外一头执行
from threading import Thread, Event
import time

event = Event()


# # 等待执行
# event.wait()
# # 可以执行了通知事件
# event.set()

def student(name):
	print("%s上课中" % name)
	# # 着急尿尿 3秒之后就撤了
	# event.wait(2)
	event.wait()
	print('%s放学了' % name)


def teacher(name):
	print("%s上课中" %name)
	time.sleep(5)
	event.set()
	print('%s放学了'%name)


if __name__ == '__main__':
	t = Thread(target=student, args=('鲁智深',))
	t1 = Thread(target=student, args=('武松',))
	t2 = Thread(target=student, args=('林冲',))
	t4 = Thread(target=teacher,args=("松江老师",))
	t.start()
	t1.start()
	t2.start()

	t4.start()
	#  event.is_set() 查看是否收到了事件
